import requests
import json


headers = {
    "accept": "application/json, text/plain, */*",
    "accept-language": "zh-CN,zh;q=0.9",
    "content-type": "application/json;charset=UTF-8",
    "origin": "https://www.xiaohongshu.com",
    "priority": "u=1, i",
    "referer": "https://www.xiaohongshu.com/",
    "sec-ch-ua": "\"Chromium\";v=\"136\", \"Google Chrome\";v=\"136\", \"Not.A/Brand\";v=\"99\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\"",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-site",
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36",
    "x-b3-traceid": "e8cbc274950fa3d1",
    "x-s": "XYS_2UQhPsHCH0c1PjhIHjIj2erjwjQhyoPTqBPT49pjHjIj2eHjwjQgynEDJ74AHjIj2ePjwjQTJdPIP/ZlgMrU4SmH4eQ9JFEFqBEbJn4Gz7mw8biIynrU2oSspBS7Pe8i/MkG8A4MyMSgnflgnnTInpze/rpicFM6no8eaDYf4LpM//ptJoG94D88LgcIznM1aURNpBpP2bSj4M4TqrkYPfRD2LpozfkOLLp0zMzYp9EVnSQC8UTa4n8hJDG6ad8t/Abc8fF9wpbzzbrIcDlOLsRwGMm9G9F32LkC8bmMzrpgGL+yJMzQHjIj2ecjwjQ6GfkSG7cjKc==",
    "x-s-common": "2UQAPsHC+aIjqArjwjHjNsQhPsHCH0rjNsQhPaHCH0c1PjhIHjIj2eHjwjQgynEDJ74AHjIj2ePjwjQhyoPTqBPT49pjHjIj2ecjwjHFN0GFN0ZjNsQh+aHCH0rE+0mSPfb08nGF8gGIP0mY8BQlGf4h8B+IqAWhqBYj4nTCGnQ1Gnkf+/ZIPeZU+AHUweZjNsQh+jHCH0r7+eWFP/L7+0PMPALjNsQh+UHCHSY8LMuUppbiLo+HcFWIGAbcyfYQaBkQy0QSqfk7ySbi2nRcpobsLbcFwgmx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49+QznRAL9468/bP4LMQyLESpFIIq7YDyepQyLkA2bm7wLSiL0StLo4tLopFpFS9P9LlpdclanSwqAbl4ApQysRAngbFLF4l47STqg4rag8QyFSeqozOyDM/+Bh7qMSc4b8QypQCanWAqM4c4FTdagkUG9EwqMSpJgpQynYPPSmFaBRl49lQ4DESpSmF8rR+8BLlJepAPFlCnDSbad+n8DRSP7bFqrlM47bQ4d8S8S87yLS3+fp3JFlSag8N8pSscnpgpdz/a/+Oq7YM4B8t8bSlaLpktFS3/dPlp94AyaRDqM4g+9pxqg4YaLpVyrSiGFzCLo4yagYk/rSkafLAp9WAwbqROaHVHdWEH0iTP/Ph+/LI+AWhPsIj2erIH0iU+dF=",
    "x-t": "1748415763535",
    "x-xray-traceid": "cb8ad9aa1c63216d509ebc0b221daec8"
}
cookies = {
    "a1": "1960e2acef4ev020adbqbgxdcps88phbukzabnajf50000272280",
    "webId": "4b6833e542f84e76fbfb34e006eddce8",
    "gid": "yjK8dJ0fS47WyjK8dJ0SdTI0i4dh8J80fDADuVikCfSUM028YYUxDD888JWJJY88jy8DJjDy",
    "customerClientId": "279177063808841",
    "abRequestId": "4b6833e542f84e76fbfb34e006eddce8",
    "x-user-id-pgy.xiaohongshu.com": "6426a4f7f95410000178a9cf",
    "x-user-id-partner.xiaohongshu.com": "616fdd2b85d0b300016960dc",
    "x-user-id-fankui-out.xiaohongshu.com": "616fdd2b85d0b300016960dc",
    "access-token-chengfeng.xiaohongshu.com": "customer.ad_wind.AT-68c517508963694122470073jfamu9hpefqkncsq",
    "customer-sso-sid": "68c517509335535213644213cqrejw7w1e9bdcjt",
    "system.alias": "ads_partner",
    "access-token-ad.xiaohongshu.com": "customer.leona.AT-68c517509335814383869378bw3qe4mtoplxjxdb",
    "ares.beaker.session.id": "1748413058264070270828",
    "webBuild": "4.64.0",
    "xsecappid": "xhs-pc-web",
    "acw_tc": "0a0b135617484154841228781ea738523068518fb517627f747d1e83510f3f",
    "websectiga": "29098a4cf41f76ee3f8db19051aaa60c0fc7c5e305572fec762da32d457d76ae",
    "sec_poison_id": "316e373f-e990-49d7-9ce9-952da0041a7b",
    "web_session": "040069b47b667a0c594b78fc033a4b3d792619",
    "loadts": "1748415654025",
    "unread": "{%22ub%22:%22682f7e2000000000230150d0%22%2C%22ue%22:%22681597d600000000220059a3%22%2C%22uc%22:57}"
}
url = "https://edith.xiaohongshu.com/api/sns/web/v1/feed"
data = {
    "source_note_id": "681b625c000000002001e239",
    "image_formats": [
        "jpg",
        "webp",
        "avif"
    ],
    "extra": {
        "need_body_topic": "1"
    },
    "xsec_source": "pc_feed",
    "xsec_token": "ABkf6BQKxm1qtcOVyvitZReVtvVoPLlLkTSf2c4vN-uzI="
}



data = json.dumps(data, separators=(',', ':'))
response = requests.post(url, headers=headers, cookies=cookies, data=data)

print(response.text)
print(response)